<template>
	<div id="MyFans">
		<x-header :left-options="{showBack: false}" class="header vux-1px-b" title="我的粉丝">
			<a slot="left"><i class="tp-icon icon-black-back" onclick="javascript:history.back(-1);"> </i></a>
		</x-header>
		<ul>
			<li v-for="item in fansList">
				<img :src="'/los/uploads/thumb/header/' + item.member.member_id + '_98X98.jpeg'" alt="" class="thumb" />
				<div class="desc">
					<p class="name">{{item.member.member_nickname}}</p>
					<p class="auction">主人很懒 什么也没留下</p>
				</div>
				<!--<div v-if="item.follow_state == 1" class="atten">已关注</div>
				<div v-else class="reatten">+关注</div>-->
			</li>
		</ul>
		<toast v-model="success" type="text" width="2.8rem">{{msg}}</toast>
	</div>
</template>

<script>
	import $ from 'jquery'
	import axios from 'axios'
	import { XHeader, Toast } from 'vux'
	export default {
		data() {
			return {
				fansList: [],
				success: false,
				msg: ''
			}
		},
		components: {
			XHeader,
			Toast
		},
		created() {
			this.getMyFans();
		},
		methods: {
			getMyFans: function() {
				let _this = this;
				let more = true;
				var page = 1;
				this.$http({
					method: 'GET',
					url: '/los/api/seller/shop_follow.json',
					data: ''
				}).then((result) => {
					this.fansList = result.data.data;

				}).catch((err) => {

				})
				$(window).scroll(function() {
					var htmlHeight = $(document).height();
					var clientHeight = $(window).height();
					var scrollTop = $(document).scrollTop();
					var overHeight = scrollTop + clientHeight;
					if(overHeight >= htmlHeight * 0.9) {
						if(more == true) {
							more = false;
							page += 1;
							axios.get('/los/api/seller/shop_follow.json' + '?page=' + page).then(function(result) {
								$.each(result.data.data, function(index, val) {
									_this.fansList.push(val);
								});
								more = true;
								if(result.data.code == 0) {
									more = false;
								}
							}).catch(function(error) {
								console.log(error);
							});
						}
					}
				})
			},
		}
	}
</script>

<style scoped>
	#MyFans {
		background: #fff;
	}
	
	.header {
		background: #fff;
	}
	
	#MyFans ul {
		position: relative;
	}
	
	#MyFans ul li {
		padding: 0.32rem 0;
		margin: 0 0.26rem;
		overflow: hidden;
		position: relative;
	}
	
	#MyFans ul li:after {
		content: " ";
		position: absolute;
		left: 0;
		bottom: 0;
		width: 200%;
		height: 1px;
		border-bottom: 1px solid #f3f3f3;
		transform-origin: 0 0;
		transform: scaleX(0.5);
	}
	
	#MyFans ul li:last-child:after {
		border: none;
	}
	
	#MyFans ul li .thumb {
		float: left;
		width: 1.33rem;
		height: 1.33rem;
		border-radius: 0.1rem;
	}
	
	#MyFans ul li .desc {
		float: left;
		width: 6.13rem;
		overflow: hidden;
		margin: 0.13rem 0 0.13rem 0.26rem;
	}
	
	#MyFans ul li .desc .name {
		float: left;
		font-size: 0.4rem;
		color: #333;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		width: 100%;
	}
	
	#MyFans ul li .desc .auction {
		float: left;
		margin-top: 0.22rem;
		color: #777;
		font-size: 0.32rem;
		width: 100%;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}
	
	#MyFans ul li .desc .auction span {
		color: #333;
		font-size: 0.34rem;
		margin-right: 1.3rem;
	}
	
	#MyFans ul li .atten {
		position: absolute;
		right: 0;
		top: 40%;
		font-size: 0.34rem;
		color: #777;
		border: solid 1px #e6e6e6;
		width: 1.65rem;
		height: 0.58rem;
		border-radius: 0.29rem;
		text-align: center;
		line-height: 0.58rem;
	}
	
	#MyFans ul li .reatten {
		position: absolute;
		right: 0;
		top: 40%;
		font-size: 0.34rem;
		color: #a30000;
		border: solid 1px #a30000;
		width: 1.65rem;
		height: 0.58rem;
		border-radius: 0.29rem;
		text-align: center;
		line-height: 0.58rem;
	}
</style>